package com.ky.home.controller;


import com.ky.common.vo.R;
import com.ky.home.mapper.ExamLogMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 答题记录 前端控制器
 * </p>
 *
 * @author pl
 * @since 2024-06-23
 */
@RestController
@RequestMapping("/home/examLog")
public class ExamLogController {
    @Autowired
    private ExamLogMapper examLogMapper;
    @Autowired
    private RedisTemplate redisTemplate;

    /**
     * 今日做题
     * @return
     */
    @RequestMapping("/todayQuestions")
    public R todayQuestions() {
        return R.ok(examLogMapper.countTodayQuestions());
    }

    /**
     * 做题总数
     * @return
     */
    @RequestMapping("/questions")
    public R questions() {
        return R.ok(examLogMapper.countQuestions());
    }
    // //查询多少人完成一个题库
    // public R completeUsers(HttpServletRequest request) {
    //     String token = request.getHeader(SystemConfig.HEADER_TOKEN);
    //     Integer id = ((NumberWithFormat) JwtUtil.parseToken(token, "id")).intValue();
    //     Integer yearId = (Integer) redisTemplate.opsForValue().get("yearId");
    //
    //
    //     QueryWrapper<ExamLog> wrapper = new QueryWrapper<>();
    //     wrapper.eq("user_id", id)
    //
    //             ;
    //     Integer integer = examLogMapper.selectCount(wrapper);
    //     return R.fail("查询失败");
    // }


}

